/**
 * Created by IntelliJ IDEA.
 * User: scotthatcher
 * Date: Mar 23, 2010
 * Time: 11:07:43 AM
 * To change this template use File | Settings | File Templates.
 File: ColorChangingSquare.java
 * ------------------------------
 * This program puts up a square in the center of the window
 * and randomly changes its color every second. */

import acm.graphics.*;
import acm.program.*;
import acm.util.*;

public class RandomCircles extends GraphicsProgram {
	/* Size of the square in pixels */
	private static final int SQUARE_SIZE = 100;

	/* Pause time in milliseconds */
	private static final int PAUSE_TIME = 1000;

	/* Number of Circles */
	private static final int CircleCount = 10;


	public void run() {
		//for (int i = 0; i < CircleCount; i++) {
			int Counter = 0;
			while (Counter < CircleCount) {

				/* Creates a random size*/
				int CircleSize = rgen.nextInt(1,800);

				/* Creates a random X coordinate*/
				int RandomX = rgen.nextInt(CircleSize,getWidth()-CircleSize);

				/* Creates a random Y coordinate*/
				int RandomY= rgen.nextInt(CircleSize,getHeight()-CircleSize);



				/*GOval circle = new GOval(RandomX, RandomY, CircleSize, CircleSize);
				circle.setFilled(true); */

				GOval circle = new GOval(RandomX, RandomY, CircleSize, CircleSize);
				circle.setFilled(true);
				add(circle);
				/*, (getWidth() - CircleSize) / 2,
						(getHeight() - CircleSize) / 2);*/

				/* Note: we meant to have this infinite loop */

				circle.setColor(rgen.nextColor());
				circle.setFilled(true);
				pause(PAUSE_TIME);
				Counter++;
			}

	//	}
}
	/* Private instance variables */
	private RandomGenerator rgen = RandomGenerator.getInstance();


}